package com.wwj.auction.admin.controller;


import com.wwj.auction.admin.entity.vo.PageModel;
import com.wwj.auction.admin.entity.vo.SellerAuditVo;
import com.wwj.auction.admin.entity.vo.SellerDetailVO;
import com.wwj.auction.admin.service.SellerAuditService;
import com.wwj.auction.common.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wwj
 * @since 2021-08-26
 */
@RestController
@RequestMapping("/admin/sellerAudit")
public class SellerAuditController {

    @Autowired
    private SellerAuditService sellerAuditService;

    /**
     * 分页查询申请卖家的审核内容
     *
     * @param page
     * @param limit
     * @param keyword
     * @return
     */
    @GetMapping("/list/{page}/{limit}")
    public R list(
            @PathVariable("page") Integer page,
            @PathVariable("limit") Integer limit,
            @RequestParam(value = "keyword", required = false) String keyword) {
        PageModel<SellerAuditVo> pageModel = sellerAuditService.list(page, limit, keyword);
        return R.ok().data("pageModel", pageModel);
    }

    /**
     * 展示审核内容的详细信息
     *
     * @param id
     * @return
     */
    @GetMapping("/show/{id}")
    public R show(@PathVariable("id") Integer id) {
        SellerDetailVO sellerDetailVO = sellerAuditService.show(id);
        return R.ok().data("sellerDetailVO", sellerDetailVO);
    }
}

